package com.help;

import java.awt.Component;

import javax.swing.JList;
import javax.swing.plaf.basic.BasicComboBoxRenderer;

import com.modelo.Marca;

public class MarcaRenderer extends BasicComboBoxRenderer
{
    public Component getListCellRendererComponent(
        JList list, Object value, int index,
        boolean isSelected, boolean cellHasFocus)
    {
        super.getListCellRendererComponent(list, value, index,
            isSelected, cellHasFocus);

        if (value != null)
        {
            Marca item = (Marca)value;
            setText( item.getNombre().toUpperCase() );
        }

        if (index == -1)
        {
        	Marca item = (Marca)value;
            //setText( "" + item.getId() );
        	setText( item.getNombre().toUpperCase()) ;
        }


        return this;
    }
}

